package com.xxgc.wujiaoredis.controller;

import com.xxgc.wujiaoredis.entity.GoodsEntity;
import com.xxgc.wujiaoredis.result.Result;
import com.xxgc.wujiaoredis.service.IGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/demo")
public class DemoController {

    @Autowired
    private IGoodsService iGoodsService;

    @GetMapping("/test")
    public String test(){
        return "这是zcc的返回响应";
    }

    @GetMapping("/selectGoods")
    public Result selectGoods(@RequestParam String merchantId){
        List<GoodsEntity> goodsEntities = iGoodsService.selectGoodsByMerchantId(merchantId);
        return Result.success(goodsEntities);
    }
}
